﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
using sqlserverextensions.Helper;


    public partial class UserDefinedFunctions
    {
        [Microsoft.SqlServer.Server.SqlFunction]
        public static SqlBoolean DirMove(SqlString sourceDir, SqlString destDir)
        {
            Int16 errSeverity = 16;

            try
            {
                System.IO.Directory.Move(sourceDir.Value, destDir.Value);
                return true; /* if nothing went wrong delete was successful */
            }
            catch (Exception ex)
            {
                ExceptionHelper.EvaluateException(ex, errSeverity);
                return false;
            }
        }
    }


